"""
实现用户注册功能
"""
import hashlib
from pymysqlutil import MysqlUtil


def register():

    """
    用户注册功能
    :return:
    """
    uid = int(input("输入id："))
    username = input("输入用户名：")
    password = input("输入用户密码：")
    password = hashlib.md5(password.encode("utf_8")).hexdigest()
    real_name = input("输入真实姓名：")
    tel = input("请输入电话号码")
    birth = input("请输入生日：")
    email = input("请输入电子邮件：")
    sex = input("请输入性别：")
    avatar = ""
    state = int(input("请输入用户状态：数值型："))
    create_time = "2024-01-01 00:00:00"
    update_time = "2024-01-01 00:00:00"
    delete = int(input("输入删除标志:"))
    sql = f"insert into tb_user values({uid},'{username}','{password}', '{real_name}', '{tel}', '{birth}', '{email}', '{sex}', '{avatar}', {state}, '{create_time}', '{update_time}', {delete});"
    print(sql)
    mysqlutil = MysqlUtil("db_xzb")
    result = mysqlutil.operator_data(sql)
    print(result)


if __name__ == '__main__':
    register()
